Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stmtctx: remove OverflowAsWarning flag #49122

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

YangKeao
Copy link
Member

@YangKeao YangKeao commented Dec 4, 2023

What problem does this PR solve?

Issue Number: close #49143, close #49137

Problem Summary:

The difference between OverflowAsWarning and TruncatedAsWarning doesn't actually exist. The existing difference are all incompatible with MySQL.

I suggest to read #49141 (comment). It gives a clearer explanation on why this PR is right.

What changed and how does it work?

This PR removes OverflowAsWarning and handle them through HandleError. Actually HandleError and HandleTruncate are the same (and HandleTruncate will be removed in this or next week). As we provided HandleErrorWithAlias, it's more appropriate for this PR.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Fix the issue that in non-strict SQL_MODE, overflow error is not regarded as warning in UPDATE, DELETE and INSERT statement.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Dec 4, 2023
Copy link

ti-chi-bot bot commented Dec 4, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Dec 4, 2023
@YangKeao
Copy link
Member Author

YangKeao commented Dec 4, 2023

/retest

@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 4, 2023
Copy link

tiprow bot commented Dec 4, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@YangKeao YangKeao force-pushed the remove-overflow-as-warning branch 2 times, most recently from f734a78 to 95fd483 Compare December 4, 2023 06:50
Copy link

codecov bot commented Dec 4, 2023

Codecov Report

Merging #49122 (8da014e) into master (d076bc1) will increase coverage by 0.5732%.
Report is 8 commits behind head on master.
The diff coverage is 57.8947%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49122        +/-   ##
================================================
+ Coverage   70.9870%   71.5603%   +0.5732%     
================================================
  Files          1368       1417        +49     
  Lines        399790     417923     +18133     
================================================
+ Hits         283799     299067     +15268     
- Misses        96179     100033      +3854     
+ Partials      19812      18823       -989     
Flag Coverage Δ
integration 43.9565% <57.8947%> (?)
unit 70.9879% <ø> (+0.0009%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 47.7150% <ø> (-5.1699%) ⬇️

@YangKeao YangKeao marked this pull request as ready for review December 4, 2023 13:16
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 4, 2023
@YangKeao YangKeao force-pushed the remove-overflow-as-warning branch 6 times, most recently from 51a3bbb to c5856a5 Compare December 5, 2023 08:14
@YangKeao YangKeao removed the release-note-none Denotes a PR that doesn't merit a release note. label Dec 6, 2023
@ti-chi-bot ti-chi-bot bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Dec 6, 2023
@@ -315,7 +313,6 @@ func NewSession(options *encode.SessionOptions, logger log.Logger) *Session {
}
}
vars.StmtCtx.SetTimeZone(vars.Location())
vars.StmtCtx.SetTypeFlags(types.StrictFlags)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is introduced in #47842. I think it's a bug, right? @lcwangchao Please confirm.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be a mistake, but introduced in previous PR: #47543 . In #47543 it overrides the type context settings before it...

@YangKeao
Copy link
Member Author

YangKeao commented Dec 6, 2023

/retest

@wuhuizuo
Copy link
Contributor

wuhuizuo commented Dec 6, 2023

/test unit-test

Copy link

tiprow bot commented Dec 6, 2023

@wuhuizuo: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@YangKeao
Copy link
Member Author

YangKeao commented Dec 6, 2023

/retest

Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

for lightning part I'll check the integration test results

@lance6716
Copy link
Contributor

/test pull-lightning-integration-test

Copy link

tiprow bot commented Dec 6, 2023

@lance6716: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test pull-lightning-integration-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@@ -196,7 +195,6 @@ func restoreSessCtx(sessCtx sessionctx.Context) func(sessCtx sessionctx.Context)
timezone = &tz
}
badNullAsWarn := sv.StmtCtx.BadNullAsWarning
overflowAsWarn := sv.StmtCtx.OverflowAsWarning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we remove OverflowAsWarning, do we need to add WithTruncateAsWarning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WithTruncateAsWarning is part of typeFlags. Here we restored the typeFlags, so it's fine to just remove OverflowAsWarning.

@lance6716
Copy link
Contributor

/retest

@SeaRise
Copy link
Contributor

SeaRise commented Dec 11, 2023

/cc @SeaRise

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 14, 2023
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
Copy link
Contributor

@SeaRise SeaRise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 14, 2023
Copy link

ti-chi-bot bot commented Dec 14, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-14 06:35:44.862718931 +0000 UTC m=+510835.899946051: ☑️ agreed by tiancaiamao.
  • 2023-12-14 07:49:44.617806322 +0000 UTC m=+515275.655033243: ☑️ agreed by SeaRise.

Copy link

tiprow bot commented Dec 14, 2023

@YangKeao: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tiprow_fast_test 8da014e link true /test tiprow_fast_test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

ti-chi-bot bot commented Dec 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, SeaRise, tiancaiamao, windtalker, zimulala

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Dec 14, 2023
@ti-chi-bot ti-chi-bot bot merged commit 531a1ce into pingcap:master Dec 14, 2023
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
8 participants